<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        let obj = {
            x:0,
            y:0
        }
        let handel = {
            set:function(target,key,value){
                if(value < 0){
                    return ;
                }
                if(value > 100){
                    return ;
                }
                target[key] = value;
            },
            get:function(target,key){
                return target[key];
            }
        }
        obj = new Proxy(obj,handel);
        obj.x = 45; 
        obj.y = 35;
        console.log(obj.x,obj.y); 
    </script>
</body>
</html>